import junit.framework.TestCase;


public class CalculatorTest extends TestCase {

	Calculator calc = new Calculator();
	
	public void testAddFN(){
		FuzzyNumber num3;
		
		GeneralSegment seglist1 = new GeneralSegment();
		//seglist1.add(new Segment(new Point(0,0),new Point(2,0)));
		//seglist1.add(new Segment(new Point(2,0),new Point(2,1)));
		seglist1.add(new Segment(new Point(1,0),new Point(2,1)));
		seglist1.add(new Segment(new Point(2,1),new Point(4,1)));
		//seglist1.add(new Segment(new Point(4,1),new Point(4,0)));
		seglist1.add(new Segment(new Point(4,1),new Point(6,0)));
		FuzzyNumber num1 = new FuzzyNumber(seglist1);
		
		GeneralSegment seglist2 = new GeneralSegment();
	    seglist2.add(new Segment(new Point(1,0),new Point(3,0)));
	    seglist2.add(new Segment(new Point(3,0),new Point(3,1)));
		seglist2.add(new Segment(new Point(3,1),new Point(4,1)));
		seglist2.add(new Segment(new Point(4,1),new Point(4,0)));
		seglist2.add(new Segment(new Point(4,0),new Point(6,0)));
		/*seglist2.add(new Segment(new Point(0,0),new Point(3,0)));
		seglist2.add(new Segment(new Point(3,0),new Point(3,1)));
		seglist2.add(new Segment(new Point(3,1),new Point(3,1)));
		seglist2.add(new Segment(new Point(3,1),new Point(3,0)));
		seglist2.add(new Segment(new Point(3,0),new Point(5,0)));*/
		FuzzyNumber num2 = new FuzzyNumber(seglist2);
		
		try {
			num3 = calc.addFN(num1, num2);
			System.out.println(num3.getAlphacuts().toString());
			num3 = calc.substractFN(num1, num2);
			System.out.println(num3.getAlphacuts().toString());
			num3 = calc.multiplyFN(num1, num2);
			System.out.println(num3.getAlphacuts().toString());
			num3 = calc.divideFN(num1, num2);
			System.out.println(num3.getAlphacuts().toString());
			System.out.println(num3.getAlphacuts().get(0.9999999999999999));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	
}
